home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / turlwin8.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  1.9 KB  |  66 lines

  1. //    Copyright (c) 1993, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        TURLWindow
  4. //    Include File:    turlwind.h
  5. //    Purpose:    Provide a window for a URL
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //    Revision History:
  8. //        12-27-93    created
  9. //        02-09-94    Split all members into seperate files.
  10. #define Uses_TProgram
  11. #define Uses_TDeskTop
  12. #include"turlwind.h"
  13.  
  14. TURLWindow::TURLWindow(const TNSCollection *TNSCp_Hist, const char *cp_URL) :
  15.     TWindow(TProgram::deskTop->getExtent(), NULL, Number()),
  16.     TWindowInit(&TWindow::initFrame)    {
  17. //    Purpose:    Constructor for the URL window, clone version.
  18. //    Arguments:    cp_URL    The url to create the window for.
  19. //    Remarks/Portability/Dependencies/Restrictions:
  20. //    Revision History:
  21. //        12-27-93    created
  22. //        03-16-94    created to clone another window.
  23.  
  24.     //    Set our window options and size
  25.     options |= ofTileable;
  26.     TRect TR = getExtent();
  27.     TR.grow(-1, -1);
  28.  
  29.     //    No view yet.
  30.     TURLV = NULL;
  31.  
  32.     //    Create the stack of visited anchors for this window.
  33.     TNSCp_visited = new TNSCollection(1, 1);
  34.     if(TNSCp_visited == NULL)    {
  35.         doslynxmessage("Unable to allocate memory for window.");
  36.         OwnerClose();
  37.     }
  38.  
  39.     //    Attempt to load the document.
  40.     URLoader(cp_URL);
  41.  
  42.     //    We have to copy the history into our own visited list here.
  43.     //    Free all names in the current list by simply destroying it.
  44.     destroy(TNSCp_visited);
  45.     //    Recreate the stack of visited anchors for this window.
  46.     TNSCp_visited = new TNSCollection(1, 1);
  47.     if(TNSCp_visited == NULL)    {
  48.         doslynxmessage("Unable to allocate memory for window.");
  49.         OwnerClose();
  50.     }
  51.  
  52.     //    Copy over the history list.
  53.     auto char *cp_clone;
  54.     for(signed short int ssi_clone = 0; ssi_clone <
  55.         TNSCp_Hist->getCount(); ssi_clone++)    {
  56.         cp_clone = newStr((const char *)(TNSCp_Hist->at(ssi_clone)));
  57.         if(cp_clone == NULL)    {
  58.             doslynxmessage("Unable to allocate memory for "
  59.                 "window.");
  60.             OwnerClose();
  61.             break;
  62.         }
  63.         TNSCp_visited->insert((void *)cp_clone);
  64.     }
  65. }
  66.